package org.example.com.kotlinlab.delegate.property_delegate.lazy_delegate.demo01

class Demo01 {
    /**
     * lazy{}只会在首次取值时进行初始化，后续调用get()都是直接返回结果
     * 默认情况下lazy{}是线程安全的
     */
    val lazyValue: String by lazy {
        println("computed!")
        "Hello"
    }
}

fun main() {
    val demo01 = Demo01()
    println(demo01.lazyValue)
    println(demo01.lazyValue)
}